#!/usr/bin/perl -w
# vim:tw=100 sw=2 expandtab ft=perl

# Example:
#
# file_attr => {
#   '/tmp/foobar' => 0644,
#   '/tmp/foobar2' => { mode => 0644, uid => 0, gid => 0 },
# },

my %attr = flatten_hash(c("$hostname/file_attr"));
while (my($file, $attr) = each %attr) {
  $attr = { -mode => $attr } unless ref $attr eq 'HASH';
  $attr->{-file} = $file;
  $attr = { map { (/^-/ ? $_ : "-$_") => $attr->{$_} } keys %$attr };
  set_attr(%$attr);
}

